package com.bitin.adorn.modules.transaction.domain;

import com.bitin.adorn.common.orm.domain.AbstractAuditableModel;
import com.bitin.adorn.modules.transaction.enumeration.PaymentState;
import jakarta.persistence.*;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Mr.Lu
 * @since 2024/8/22 15:19
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Entity
@Table
public class PaymentInstallment extends AbstractAuditableModel {
    /**
     * 总分期数
     */
    private Integer total;
    /**
     * 当前期数
     */
    private Integer current;
    /**
     * 付款金额
     */
    private BigDecimal amount;
    /**
     * 付款状态
     */
    @Enumerated(value = EnumType.STRING)
    private PaymentState state;

    /**
     * 付款时间
     */
    private LocalDateTime paymentTime;
    /**
     * 支付凭证
     */
    @ElementCollection(fetch = FetchType.EAGER)
    private List< String > vouchers = new ArrayList<>();
}
